package com.geeklan.smart.data.auth;

import android.content.Context;

import com.geeklan.smart.event.LoginOut;

import org.greenrobot.eventbus.EventBus;

public class AuthManager {
    private static AuthManager instance;
    private Context appContext;

    private AuthManager(Context context) {
        this.appContext = context.getApplicationContext();
    }

    public static void init(Context context) {
        if (instance == null) {
            instance = new AuthManager(context);
        }
    }

    public static AuthManager getInstance() {
        if (instance == null) {
            throw new IllegalStateException("AuthManager is not initialized. Call init() first.");
        }
        return instance;
    }

    public void logoutAndRedirectToLogin() {
        EventBus.getDefault().post(new LoginOut());
    }
}

